package com.shangcheng.users.dao;

import com.shangcheng.users.pojo.User;
import feign.Param;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

/****
 * @Author:admin
 * @Description:User的Dao
 * @Date 2019/6/14 0:12
 *****/
public interface UserMapper extends Mapper<User> {
    /**
     * 下单成功后用户积分增加
     */
    @Update("update tb_user set points = points+#{points} where username LIKE #{username}")
    int updatePoints(@Param("points") Integer points, @Param("username") String username);

    @Delete("DELETE FROM tb_user WHERE username LIKE #{username}")
    int delelte(@Param("username") String username);

    @Select("select * FROM tb_user WHERE username LIKE #{username}")
    User findByName(@Param("username") String username);
}
